package generics.enumtype;

public enum OperatorEnum {
    PLUS("+") {
        @Override
        double apply(double x, double y) {
            return x + y ;
        }
    },
    MINUS("-") {
        @Override
        double apply(double x, double y) {
            return x-y;
        }
    },
    TIMES("*") {
        @Override
        double apply(double x, double y) {
            return x*y;
        }
    },
    DIVIDE("/") {
        @Override
        double apply(double x, double y) {
            return x/y;
        }
    };

    private final String symbol;

    OperatorEnum(String symbol) {
        this.symbol = symbol;
    }

    abstract double apply(double x, double y) ;
}
